package cn.tangsihai.hrm.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * 针对前端展示课程的文档映射
 * indexName：索引库
 * type：索引类型
 */
@Data
@Document(indexName = "hrm", type = "course")
public class CourseESDoc {
    @Id // 对应的文档id
    private Long id;
    // Field：字段类型，指定字段的映射属性
    // FieldType.Text：分词，FieldType.Keyword：不分词
    //课程名字 :要分词 ，指定IK分词器
    @Field(type =FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String name;
    // 适合人群
    @Field(type =FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String forUser;

    @Field(type =FieldType.Keyword)
    private String gradeName;

    private Long courseTypeId;

    @Field(type =FieldType. Keyword)
    private String tenantName;

    @Field(type =FieldType.Keyword,index = false)
    private String pic;

    private Long tenantId;

    private Integer saleCount;

    private Integer viewCount;

    private Integer commentCount;

    private Date onlineTime;

    @Field(type =FieldType.Keyword)
    private String chargeName;

    private Float price;

    private Float priceOld;
}